home *** CD-ROM | disk | FTP | other *** search
- -- background: 2163 from stack: in
- -- bmap block id: 0
- -- flags: 4000
- -- background id: 0
- -- name: Graph
- ----- HyperTalk script -----
- on openCard
- global lstfld, curfld
- push recent card
- if curfld = "" then put "0" into curfld
- if lstfld <> curfld
- then
- graphY1 lstfld
- put lstfld into curfld
- end if
- end opencard
-
- on clearScreen full
- choose select tool
- if full = true then
- doMenu select all
- else
- drag from 0,framebottom()-1 to 512,0
- end if
- doMenu clear picture
- end clearScreen
-
- function frheight
- return 260
- end frameheight
-
- function framewidth
- return 310
- end framewidth
-
- function framebottom
- return 280
- end framebottom
-
- function frameleft
- return 110
- end frameleft
-
- function maxline what
- put 0 into result
- repeat with i = 1 to the number of lines in what
- put max(line i of what,result) into result
- end repeat
- return result
- end maxLine
-
- on drawframe drawX
- global y2ofs
- reset paint
- choose text tool
- set the textFont to Geneva
- set textSize to 9
- set textAlign to Center
- put the number of cards of bg "User Cards" into datacount
- put frameleft() into horiz
- put round(framewidth()/(dataCount-1)) into XStep
- put round (14 / xstep) into num1
- repeat with i = 1 to dataCount
- if drawX then
- if ( i mod num1 = 0) then
- choose text tool
- click at horiz,framebottom()+20
- type i
- doMenu Select
- doMenu rotate right
- end if
- choose line tool
- drag from horiz,framebottom()+3 to horiz,framebottom()
- end if
- add XStep to horiz
- end repeat
- choose line tool
- subtract XStep from horiz
- put horiz into y2ofs
- drag from frameleft(),framebottom() to horiz,framebottom()
- reset paint
- choose browse tool
- end drawframe
-
- on drawY fld, algn, xpos
- reset paint
- choose text tool
- set the textFont to Geneva
- set textSize to 9
- set textHeight to 9
- set textAlign to algn
- put maxLine (field fld) into maxY
- if maxY < 18 then put maxY into incr else put 18 into incr
- put the number of lines in field fld into datacount
- put round(frheight()/incr) into Y1Step
- put framebottom() into vert
- repeat with i = 0 to incr
- choose text tool
- put round(maxY/incr*i) into ndx
- put round(frheight()* ndx / maxY) into height1
- click at xpos,framebottom()-height1
- type round(maxY/incr*i) & "_"
- subtract Y1Step from vert
- end repeat
- choose browse tool
- end drawY
-
- on getData src,bkg,dst
- global lstfld
- put "" into field dst
- if (the number of cards in background bkg) < 3 then
- answer "No data! Use Load Data first." with "OK"
- put "0" & return & "1" into field dst
- else
- repeat with i = 1 to the number of cards in background bkg
- set the cursor to busy
- put (field src of card i of background bkg) & return after field dst
- end repeat
- end if
- end getData
-
- on drawgraph
- reset paint
- choose line tool
- put maxLine (field Y1) into maxY
- put the number of lines in field Y1 into datacount
- put round(framewidth()/dataCount) into Y1Step
- put frameleft() into horiz
- put round(framewidth()/(dataCount-1)) into XStep
- get line 1 of field Y1
- repeat with i = 1 to dataCount
- get line i of field Y1
- if it is not empty then
- put round(frheight() * it / maxY) into height
- drag from horiz,framebottom()-1 to horiz,framebottom()-height
- end if
- add XStep to horiz
- end repeat
- reset paint
- choose browse tool
- end drawgraph
-
-
- on doLegend
- global fldname
- reset paint
- lock screen
- choose text tool
- set textAlign to center
- set textSize to 12
- set textFont to Chicago
- click at 400,40
- type fldname
- choose browse tool
- end doLegend
-
- on graphY1 fld
- global newdata, fldname
- -- put "true" into newdata
- clearscreen newdata
- drawframe newdata
- put "false" into newdata
- getdata fld,"User Cards","Y1"
- drawY "Y1",right,frameleft()-1
- drawgraph "Y1",12,"Y1"
- doLegend fldname
- end graphY1
-
-
-
-
- -- part 2 (field)
- -- low flags: 80
- -- high flags: 4000
- -- rect: left=5 top=9 right=28 bottom=110
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Name
-
-
- -- part 1 (field)
- -- low flags: 81
- -- high flags: 0000
- -- rect: left=3 top=63 right=255 bottom=69
- -- title width / last selected line: 0
- -- icon id / first selected line: 0 / 0
- -- text alignment: 0
- -- font id: 3
- -- text size: 12
- -- style flags: 0
- -- line height: 16
- -- part name: Y1
-